//


import UIKit

protocol WP_EmptyViewDelegate :NSObjectProtocol{
    func GoBlcok()  //
}
class WP_EmptyView: UIView {
   
    weak var delegate:WP_EmptyViewDelegate?
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.white
        self.frame = UIScreen.main.bounds
        
        self.addSubview(titleLabel)
        self.addSubview(detailLabel)
        self.addSubview(addBtn)
    }
    
    lazy var titleLabel:UILabel = {
        let label = UILabel(frame: CGRect(x: 0, y: kScreenHeight/2-100, width: kScreenWidth, height: 40))
        label.textColor = UIColor.black
        label.textAlignment = .center
        label.font = FontPFBold(22)
        label.text = "NoData"
        return label
    }()
    lazy var detailLabel:UILabel = {
        let label = UILabel(frame: CGRect(x: 0, y: titleLabel.frame.maxY, width: kScreenWidth, height: 40))
        label.textColor = UIColor.black
        label.font = FontPFMedium(16)
        label.textAlignment = .center
        label.text = "There's no data yet, so go ahead and add it"
        return label
    }()
    
    lazy var addBtn:UIButton = {
        let btn = UIButton(frame: CGRect(x: 100, y: detailLabel.frame.maxY+30, width: kScreenWidth-200, height: 40))
        btn.layer.cornerRadius = 10
        btn.setTitle("To Add", for: .normal)
        btn.setTitleColor(UIColor.white, for: .normal)
        btn.titleLabel?.font = FontPFRegular(20)
        btn.backgroundColor = UIColorFromHex(0xFF8247)
        btn.addTarget(self, action: #selector(Onclick), for: .touchUpInside)
        return btn
    }()
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //
    @objc func Onclick() {
        delegate?.GoBlcok()
    }

}
